from time import sleep

from selenium.webdriver.common.by import By

from seleniumtest_base.base.base_page import BasePage


class LoginPage(BasePage):
    #页面的元素
    username_loc = (By.NAME,"userName")
    username_loc1 = (By.ID,"TANGRAM__PSP_11__userName")
    password_loc1 = (By.ID,"TANGRAM__PSP_11__password")
    password_loc = (By.NAME,"password")
    submit_loc = (By.ID,"TANGRAM__PSP_11__submit")
    submit = (By.XPATH,"//a[@class='s-top-login-btn c-btn c-btn-primary c-btn-mini lb']")
    frame = (By.XPATH, "//iframe[@frameborder='0']")


    #页面的动作
    def login_baidu(self,userName,password):
        self.click(LoginPage.submit)
        sleep(5)
        self.set_key(LoginPage.username_loc1,userName="15140542476")
        sleep(5)
        self.set_key(LoginPage.password_loc1,password="l19920903123")
        sleep(5)
        self.click(LoginPage.submit_loc)
